<?php
namespace Common\Model\Log;
use Think\Model;

class LogModel extends Model
{
    protected $name = 'logs';

    const FENXIAO_BIND = '分销用户绑定';
    const FENXIA_REWARD = '分销奖励发放';

    public function addLog($module = '', $content = [],$tag = '')
    {
        try {
            $t_logs = M("logs");
            $data['created_at'] = date("Y-m-d H:i:s", time());
            $data['level'] = "info";
            $data['tag'] = $tag;
            $contentData = is_array($content) ? $content : [
                "msg" => $content,
            ];
            $data['content'] = json_encode($contentData, JSON_UNESCAPED_UNICODE);
            $data['module'] = $module;
            return $t_logs->add($data);
        } catch (\Exception $e) {
        }
    }
}

?>
